/**
 * ProjectDbAction.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.web.actions;

import ro.prjmanager.core.annotations.*;
import ro.prjmanager.model.ProjectDb;
import ro.prjmanager.web.annotation.NomenclatorTarget;
import ro.prjmanager.web.annotation.Service;

@Service(target = "projectdbService")
@NomenclatorTarget(addTarget = "add",deleteTarget = "del",editTarget = "edit",
        resource = "/pages/nomenclators/projectdb/projectdb.jsp",
        onFaildReturn = "/pages/nomenclators/projectdb/projectdb.jsp")
@List(serviceName = "projectdbService",
        caption = "ProjectDb List",
        editUrl = "%context_path%/actions/ProjectDb.action",
        id = "1", height = 200, rowNum = 10,
        url = "%context_path%/projectdb.lst")
public class ProjectDbAction extends GenericAction<ProjectDb> {

    @Id
    private Long idL;

    @Column(name = "fkProject", caption = "Project", index = "fkProject", width = 250, editOptions = @EditOptions(pos = 2 ,required = true , prefix = "(*)" ,edittype = "select",size = 1 ))
    @SelectOption(id="fkProject",serviceName = "projectsService")
    private java.lang.Integer fkProject;

    @Column(name = "fkDbSchema", caption = "Database schema", index = "fkDbSchema", width = 250, editOptions = @EditOptions(pos = 3 ,required = true , prefix = "(*)" ,edittype = "select",size = 1 ))
    @SelectOption(id="fkDbSchema",serviceName = "dbschemaService")
    private java.lang.Integer fkDbSchema;

    @Column(name = "name", caption = "Name", index = "name", width = 200, editOptions = @EditOptions(pos = 4  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String name;

    public Long getIdL() {
        if(getId()!=null&&!getId().isEmpty()&&!getId().equals("_empty"))
          idL=Long.valueOf(getId());
        return idL;
    }

    public void setIdL(Long idL) {
        this.idL = idL;
        if(idL!=null)
            this.setId(String.valueOf(idL));
    }

    /**
     * This method gets the fkProject attribute
     * @return - an  java.lang.Integer  object
     **/
    public  java.lang.Integer  getFkProject(){
        return this.fkProject;
    }

    /**
     * The setter for the fkProject attribute
     * @param fkProject -  an  java.lang.Integer  object
     **/
    public void setFkProject( java.lang.Integer  fkProject){
        this.fkProject=fkProject;
    }
    /**
     * This method gets the fkDbSchema attribute
     * @return - an  java.lang.Integer  object
     **/
    public  java.lang.Integer  getFkDbSchema(){
        return this.fkDbSchema;
    }

    /**
     * The setter for the fkDbSchema attribute
     * @param fkDbSchema -  an  java.lang.Integer  object
     **/
    public void setFkDbSchema( java.lang.Integer  fkDbSchema){
        this.fkDbSchema=fkDbSchema;
    }
    /**
     * This method gets the name attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getName(){
        return this.name;
    }

    /**
     * The setter for the name attribute
     * @param name -  an  java.lang.String  object
     **/
    public void setName( java.lang.String  name){
        this.name=name;
    }


    public void add() {
        ProjectDb adderObj=getModel();
        getService().create(adderObj);

    }
    public void edit() {
         ProjectDb editObj=getModel();
        getService().update(editObj);
    }

}
